package com.company.pangu.sensitive.strategy;

import com.company.pangu.sensitive.enums.SensitiveDefaultLengthEnum;
import com.company.pangu.sensitive.util.SensitiveInfoUtils;

/**
 * 密码脱敏
 *
 * @author youyoukele
 * @version 1.0
 * @date 2022/09/05 10:34
 */
public class SensitivePassword implements IStrategy {

    @Override
    public String desensitization(String password, int begin, int end) {
        if (begin != SensitiveDefaultLengthEnum.PASSWORD.getBegin() && begin != 0) {
            return SensitiveInfoUtils.password(password, begin);
        }
        return SensitiveInfoUtils.password(password, SensitiveDefaultLengthEnum.PASSWORD.getBegin());
    }

}
